﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Xejen.Framework.Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            MessagingCenter.Subscribe("中国", () =>
            {
                textBox1.Text += "收到消息了" + Environment.NewLine;
            });

            MessagingCenter.Subscribe(message: "国家", callback: (string contry) =>
            {
                textBox1.Text += contry + Environment.NewLine;
            });

            MessagingCenter.Subscribe<MainForm, string>(this, message: "花", callback: (MainForm sender, string contry) =>
            {
                textBox1.Text += contry + Environment.NewLine;
            });

            MessagingCenter.Subscribe<MainForm>(this, message: "消息", callback: (MainForm sender) =>
            {
                textBox1.Text += "来来来了" + Environment.NewLine;
            });

            textBox1.Text = @"cdsa
ds
fsda
fsd
af
sa
sda
we

fw
we
";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("测试");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("button2");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("button3");
        }
    }
}
